/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package group2assignone.ucm.manager;

import group2assignone.dao.MyDAO;
import group2assignone.ucm.UCController;
import group2assignone.ucm.UCStartup;
import group2assignone.view.manager.ManagerView;
import group2assignone.view.manager.SalesReportView;

/**
 * Use Case: Change UI to Sales Report View                        <br>
 * Pre-condition: View Sales report is clicked from Manager MainView.<br>
 * Post-condition: Sales Report view is displayed                           <br>
 * 1. system exits the current view                                         <br>
 * 2. System generates the report                                     <br>
 * 3. System retrievs the report                                            <br>
 * 4. System  opens the Sales Reort View                            <br>


 * @author group2
 */
public class UCUIViewSalesReport implements UCController {

    public void run() {
         //1. system exits the current view
        ManagerView mv = ManagerView.getInstance();
        mv.dispose();
        //2. System generates the report
        MyDAO coms = UCStartup.getInstance().getDAO();
        coms.sQLGenerateSalesReport();
        //3. System retrievs the report
        SalesReportView view = new SalesReportView(coms.sQLGetSalesReport());
        //4. System  opens the Sales Reort View
        view.go();
    }
}
